import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PayBlackVO, PayBlackForm, PayBlackQuery } from '@/api/system/PayBlack/types';

/**
 * 查询IP黑名单列表
 * @param query
 * @returns {*}
 */

export const listPayBlack = (query?: PayBlackQuery): AxiosPromise<PayBlackVO[]> => {
  return request({
    url: '/system/PayBlack/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询IP黑名单详细
 * @param id
 */
export const getPayBlack = (id: string | number): AxiosPromise<PayBlackVO> => {
  return request({
    url: '/system/PayBlack/' + id,
    method: 'get'
  });
};

/**
 * 新增IP黑名单
 * @param data
 */
export const addPayBlack = (data: PayBlackForm) => {
  return request({
    url: '/system/PayBlack',
    method: 'post',
    data: data
  });
};

/**
 * 修改IP黑名单
 * @param data
 */
export const updatePayBlack = (data: PayBlackForm) => {
  return request({
    url: '/system/PayBlack',
    method: 'put',
    data: data
  });
};

/**
 * 删除IP黑名单
 * @param id
 */
export const delPayBlack = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/PayBlack/' + id,
    method: 'delete'
  });
};
